<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>Docs For Class DataTable</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
						<script src="../media/lib/classTree.js"></script>
												<script language="javascript" type="text/javascript">
				var imgPlus = new Image();
				var imgMinus = new Image();
				imgPlus.src = "../media/images/plus.png";
				imgMinus.src = "../media/images/minus.png";
				
				function showNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgMinus.src;
					oTable.style.display = "block";
				}
				
				function hideNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgPlus.src;
					oTable.style.display = "none";
				}
				
				function nodeIsVisible(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
									break;
							}
					return (oTable && oTable.style.display == "block");
				}
				
				function toggleNodeVisibility(Node){
					if (nodeIsVisible(Node)){
						hideNode(Node);
					}else{
						showNode(Node);
					}
				}
			</script>
					</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../media/images/Class_logo.png"
														alt=" Class"
														title=" Class"
														style="vertical-align: middle"> DataTable</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A DataTable represents the data that will be visualized in a chart.</p>
<p class="description"><p>Google Chart Tools uses a table-format as data-storage. The actual function  of the table's head and cells depends on the chart the data is used for (e. g. in  pie-charts, a table with two rows is used where the first column represents  the slices' label. The second column is used as the slices' value).</p><p>The DataTable is divided into a column-definition (the table's header) and  rows. By the column definition, the column's value-type (string, number, etc.)  is specified and the data (that will be visualized) is stored in the rows.</p><p><strong>Example:</strong>  Lets assume the table below should be stored in a DataTable.</p><p><pre> |----------------|-----------------------|
 | Name: Task     | Name: Hours per Day   |
 | Type: string   | Type: Number          |
 |----------------|-----------------------|
 |    Work        |   11                  |
 |    Eat         |   2                   |
 |    Commute     |   2                   |
 |    Watch TV    |   2                   |
 |    Sleep       |   7                   |
 |----------------|-----------------------|</pre></p><p>This table will be represented by the DataTable through the following code:  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-var">$labelColumn&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Column.html">Column</a></span><span class="src-sym">(</span><span class="src-id"><a href="../model/Column.html">Column</a></span><span class="src-sym">::</span><span class="src-id">STRING</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;t&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;Task&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$valueColumn&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Column.html">Column</a></span><span class="src-sym">(</span><span class="src-id"><a href="../model/Column.html">Column</a></span><span class="src-sym">::</span><span class="src-id">NUMBER</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;h&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;Hours&nbsp;per&nbsp;Day&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$data&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/DataTable.html">DataTable</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$data</span><span class="src-sym">-&gt;</span><a href="../model/DataTable.html#methodaddColumn">addColumn</a><span class="src-sym">(</span><span class="src-var">$labelColumn</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$data</span><span class="src-sym">-&gt;</span><a href="../model/DataTable.html#methodaddColumn">addColumn</a><span class="src-sym">(</span><span class="src-var">$valueColumn</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$workRow&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Row.html">Row</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$workRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-str">&quot;Work&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$workRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-num">11</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$data</span><span class="src-sym">-&gt;</span><a href="../model/DataTable.html#methodaddRow">addRow</a><span class="src-sym">(</span><span class="src-var">$workRow</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$eatRow&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Row.html">Row</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$eatRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-str">&quot;Eat&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$eatRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$data</span><span class="src-sym">-&gt;</span><a href="../model/DataTable.html#methodaddRow">addRow</a><span class="src-sym">(</span><span class="src-var">$eatRow</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$commuteRow&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Row.html">Row</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$commuteRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-str">&quot;Commute&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$commuteRow</span><span class="src-sym">-&gt;</span><span class="src-id">addCell</span><span class="src-sym">(</span><span class="src-key">new&nbsp;</span><span class="src-id"><a href="../model/Cell.html">Cell</a></span><span class="src-sym">(</span><span class="src-num">2</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;...</div></li>
</ol></div></p><p>You will find detailed information on how many columns are supported by a specific  chart, their purpose etc. in detail at the corresponding chart's subpage  published at <a href="https://google-developers.appspot.com/chart/interactive/docs/gallery">https://google-developers.appspot.com/chart/interactive/docs/gallery</a>.</p></p>
		<p class="notes">
			Located in <a class="field" href="_googlecharttools---model---DataTable.class.php.html">/googlecharttools/model/DataTable.class.php</a> (line <span class="field">88</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>




	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
												<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																																																																															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../model/DataTable.html">DataTable</a></span>
										<a href="#addColumn" title="details" class="method-name">addColumn</a>
											(<span class="var-type"><a href="../model/Column.html">Column</a></span>&nbsp;<span class="var-name">$col</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../model/DataTable.html">DataTable</a></span>
										<a href="#addRow" title="details" class="method-name">addRow</a>
											(<span class="var-type"><a href="../model/Row.html">Row</a></span>&nbsp;<span class="var-name">$row</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">void</span>
										<a href="#addRowsAssocArray" title="details" class="method-name">addRowsAssocArray</a>
											(<span class="var-type">string[]</span>&nbsp;<span class="var-name">$array</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">Column[]</span>
										<a href="#getColumns" title="details" class="method-name">getColumns</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int</span>
										<a href="#getColumnsCount" title="details" class="method-name">getColumnsCount</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">Row[]</span>
										<a href="#getRows" title="details" class="method-name">getRows</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int</span>
										<a href="#getRowsCount" title="details" class="method-name">getRowsCount</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#toJson" title="details" class="method-name">toJson</a>
										()
									</div>
											</div>
		</div>
	</div>		

	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodaddColumn" id="addColumn"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">addColumn</span> (line <span class="line-number">104</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Adds a new column definition to the table.</p>
	<ul class="tags">
				<li><span class="field">return:</span> This object.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../model/DataTable.html">DataTable</a></span>
		<span class="method-name">
			addColumn
		</span>
					(<span class="var-type"><a href="../model/Column.html">Column</a></span>&nbsp;<span class="var-name">$col</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"><a href="../model/Column.html">Column</a></span>
				<span class="var-name">$col</span><span class="var-description">: The new column definition.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodaddRow" id="addRow"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">addRow</span> (line <span class="line-number">120</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Adds a new data-row to the table.</p>
	<ul class="tags">
				<li><span class="field">return:</span> This object.</li>
				<li><span class="field">throws:</span> \InvalidArgumentException               Thrown, if the row has more cells than column definitions               have been added with the <a href="../model/DataTable.html#methodaddColumn">addColumn()</a> method.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../model/DataTable.html">DataTable</a></span>
		<span class="method-name">
			addRow
		</span>
					(<span class="var-type"><a href="../model/Row.html">Row</a></span>&nbsp;<span class="var-name">$row</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"><a href="../model/Row.html">Row</a></span>
				<span class="var-name">$row</span><span class="var-description">: The new row.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodaddRowsAssocArray" id="addRowsAssocArray"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">addRowsAssocArray</span> (line <span class="line-number">139</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Fills the DataTable by reading an associative array.</p>
<p class="description"><p>Every element of the array will be seen as a new row whereby the  array's keys are used for the first column and the array's values  for the second column. Thus, this will require a DataTable with two columns  only.</p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			addRowsAssocArray
		</span>
					(<span class="var-type">string[]</span>&nbsp;<span class="var-name">$array</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string[]</span>
				<span class="var-name">$array</span><span class="var-description">: An associative array.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetColumns" id="getColumns"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getColumns</span> (line <span class="line-number">174</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Gets all columns that have been added to the DataTable.</p>
	<ul class="tags">
				<li><span class="field">return:</span> The DataTable's columns.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Column[]</span>
		<span class="method-name">
			getColumns
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetColumnsCount" id="getColumnsCount"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getColumnsCount</span> (line <span class="line-number">154</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Gets the number of columns that have been added to the DataTable.</p>
	<ul class="tags">
				<li><span class="field">return:</span> Number of columns added with <a href="../model/DataTable.html#methodaddColumn">addColumn()</a>.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			getColumnsCount
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetRows" id="getRows"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getRows</span> (line <span class="line-number">184</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Gets all rows that have been added to the DataTable.</p>
	<ul class="tags">
				<li><span class="field">return:</span> The DataTable's rows.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Row[]</span>
		<span class="method-name">
			getRows
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetRowsCount" id="getRowsCount"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getRowsCount</span> (line <span class="line-number">164</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Gets the number of rows that have been added to the DataTable.</p>
	<ul class="tags">
				<li><span class="field">return:</span> Number of rows added with <a href="../model/DataTable.html#methodaddRow">addRow()</a>.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			getRowsCount
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodtoJson" id="toJson"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">toJson</span> (line <span class="line-number">197</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Converts this object into a JSON-object.</p>
<p class="description"><p>This representation follows the JavaScript literal format specified  at <a href="https://google-developers.appspot.com/chart/interactive/docs/reference#dataparam">https://google-developers.appspot.com/chart/interactive/docs/reference#dataparam</a>.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The JSON representation of this DataTable.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			toJson
		</span>
				()
			</div>
	
		
			
	</div>
						
		</div>
	</div>

	
	<p class="notes" id="credit">
		Documentation generated on Mon, 01 Oct 2012 16:45:05 +0200 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.4</a>
	</p>
	</div></body>
</html>